import request from '@/utils/request'

// 查询广告投放策略列表
export function listStrategy(query) {
  return request({
    url: '/advertisement/strategy/list',
    method: 'get',
    params: query
  })
}

// 查询广告投放策略详细
export function getStrategy(strategyId) {
  return request({
    url: '/advertisement/strategy/' + strategyId,
    method: 'get'
  })
}

// 新增广告投放策略
export function addStrategy(data) {
  return request({
    url: '/advertisement/strategy',
    method: 'post',
    data: data
  })
}

// 修改广告投放策略
export function updateStrategy(data) {
  return request({
    url: '/advertisement/strategy',
    method: 'put',
    data: data
  })
}

// 删除广告投放策略
export function delStrategy(strategyIds) {
  return request({
    url: '/advertisement/strategy/' + strategyIds,
    method: 'delete'
  })
}

// 查询广告素材列表
export function listMaterial(query) {
  return request({
    url: '/advertisement/material/list',
    method: 'get',
    params: query
  })
}

// 查询广告素材详细
export function getMaterial(materialId) {
  return request({
    url: '/advertisement/material/' + materialId,
    method: 'get'
  })
}

// 新增广告素材
export function addMaterial(data) {
  return request({
    url: '/advertisement/material',
    method: 'post',
    data: data
  })
}

// 修改广告素材
export function updateMaterial(data) {
  return request({
    url: '/advertisement/material',
    method: 'put',
    data: data
  })
}

// 删除广告素材
export function delMaterial(materialIds) {
  return request({
    url: '/advertisement/material/' + materialIds,
    method: 'delete'
  })
}

// 上传广告素材文件
export function uploadMaterial(data) {
  return request({
    url: '/advertisement/material/upload',
    method: 'post',
    data: data
  })
}

// 预览广告素材
export function previewMaterial(materialId) {
  return request({
    url: '/advertisement/material/preview/' + materialId,
    method: 'get'
  })
}
